import java.util.*;

public class MapSmallProjects {

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        //存放数据
        String[] str = new String[]{"A","B","C","D"};
        Random random = new Random();
        for (int i = 1; i < 81 ; i++) {
            int index = random.nextInt(4);
            String data =  str[index];
            list.add(data);
        }
        /*System.out.println(list);*/
        Map<String,Integer> map = new HashMap<>();
        for (String k : list) {
            if (map.containsKey(k)){
                int v = map.get(k) + 1;
                map.put(k,v);
            }else {
                map.put(k,1);
            }
        }
        System.out.println(map);

        Set<String> set = map.keySet();
        String s = "";
        int v = 0;
        for (String k:set) {
            if (map.get(k) > v){
                v = map.get(k);
                s = k;
            }
        }
        System.out.println(s+" "+v);
    }
}
